{extend name="layout/layout" /}


{block name="style"}
	<style>

		.account{
			margin-bottom: 50px;
		}

		.mui-btn-theme{
			border-radius: 0;
			position: fixed;
			left: 0;
			bottom: 0;
			width:100%;
		}

		.info{
			padding-left: 20px;
		}
		
		.del-btn{
			border-color: #e60012;
			color: #e60012;
			padding: 3px 5px;
			font-size: 12px;
		}

		.mui-table-view-cell{
			border-bottom: 1px solid #ccc;
		}

		.mui-card{
			margin: 10px 0;
		}

		.mui-card-content{
			padding: 10px;
		}
	</style>
{/block}

{block name="main"}
	<div class="account" v-cloak>
		<div class="list" v-if="list.length > 0">
			<div class="mui-card" v-for="item, index in list">
				<!--页眉，放置标题-->
				<div class="mui-card-header">
					<div class="mui-col-xs-12">
						<div class="mui-pull-left">{{item.create_time}}</div>
						<div class="mui-pull-right"><b class="text-theme">{{item.status_text}}</b></div>
					</div>
				</div>
				<!--内容区-->
				<div class="mui-card-content">
					<p>反馈内容：{{item.content}}</p>
					<p v-if="item.reply">回复：{{item.reply}}</p>
				</div>
			</div>
		</div>
		<p v-else class="mui-text-center">没有相关记录</p>

		<a href="{:url('feedback/add')}" class="mui-btn mui-btn-block mui-btn-theme">提交反馈</a>
	</div>
{/block}
{block name="navbar"}{/block}
{block name="script"}
	<script>
		var myVue = new Vue({
			el:'.account',
			data:{
				list:[],
			},
			mounted: function(){
				if(token){
					this.token = token;
					console.log(this.token);
					this.getDetail();
				} else {
					this.login();
				}

			},
			methods: {
				getDetail: function(){
					layer.open({
						type:2,
						shadeClose:false,
						shade: 'background-color: rgba(0,0,0,.3)',
					});
					var url =  'feedback/index';
					var that = this;
					request(that, {'url': url}, function(res){
						layer.closeAll();
						if(res.code == 200) {
							that.list = res.data;
						} else {
							mui.toast(res.msg);
						}	
					});
				},
				login:function(){
					location.href = '/mobile/user/login';
				},
				//删除
				del: function(item, index){
					var that = this;
					mui.confirm('确认删除该提现帐号吗？', '提示', ['取消', '确认'], function(e) {
	                    if (e.index == 1) {
							var url =  'funds/delAccount';
							layer.open({
								type:2,
								shadeClose: false,
							});

							request(that, {'url': url, 'data': {'id':item.id}}, function(res) {
								layer.closeAll();
								if(res.code == 200) {
									that.list.splice(index,1);
								}	
								mui.toast(res.msg);
							})
						}
					});
				},
			}
		});
	</script>
{/block}